<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EventsSoapController
 *
 * @author tien.nguyen
 */
class EventsSoapController extends Zend_Controller_Action {
    	//change this to your WSDL URI!
    private $_WSDL_URI = "http://localhost/DetaiAndroid/public/events-soap?wsdl";

    /**
     * Action index in soap controller
     * @author Tien Nguyen
     */
    public function indexAction() {
        $this->_helper->viewRenderer->setNoRender();
        if (isset($_GET['wsdl'])) {
            //return the WSDL
            $this->hadleWSDL();
        } else {
            //handle SOAP request
            $this->handleSOAP();
        }
    }

    /**
     * Webservice 
     * @author Tien Nguyen
     */
    private function hadleWSDL() {
        $autodiscover = new Zend_Soap_AutoDiscover();
        $autodiscover->setClass('Webservices_Events');
        $autodiscover->handle();
    }

    /**
     * Webservice with soap
     * @author Tien Nguyen
     */
    private function handleSOAP() {
        $soap = new Zend_Soap_Server($this->_WSDL_URI);
        $soap->setClass('Webservices_Events');
        $soap->handle();
    }

    /**
     * Action for test webservice
     * @author Tien Nguyen
     */
    public function clientAction() {
        $client = new Zend_Soap_Client($this->_WSDL_URI);
        Zend_Debug::dump($client->getCategoryById('admin', '123', 1)); die;
        //Zend_Debug::dump($client->getEvents('admin', '123456'));
       $this->_helper->viewRenderer->setNoRender();
    }
    
}

?>
